package com.ruoyi.dwzzzy.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.dwzzzy.domain.QualifSource;
import com.ruoyi.dwzzzy.mapper.QualifSourceMapper;
import com.ruoyi.dwzzzy.service.IQualifSourceService;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 单位资质资源Service业务层处理
 * 
 * @author 张维
 * @date 2021-03-19
 */
@Service
public class QualifSourceServiceImpl implements IQualifSourceService 
{
    @Autowired
    private QualifSourceMapper qualifSourceMapper;

    /**
     * 查询单位资质资源
     * 
     * @param id 单位资质资源ID
     * @return 单位资质资源
     */
    @Override
    public QualifSource selectQualifSourceById(Long id)
    {
        return qualifSourceMapper.selectQualifSourceById(id);
    }

    /**
     * 查询单位资质资源列表
     * 
     * @param qualifSource 单位资质资源
     * @return 单位资质资源
     */
    @Override
    public List<QualifSource> selectQualifSourceList(QualifSource qualifSource)
    {
        return qualifSourceMapper.selectQualifSourceList(qualifSource);
    }

    /**
     * 新增单位资质资源
     * 
     * @param qualifSource 单位资质资源
     * @return 结果
     */
    @Override
    public int insertQualifSource(QualifSource qualifSource)
    {
        SysUser user = ShiroUtils.getSysUser();
        qualifSource.setUploadPerson(user.getUserName());
        qualifSource.setUploadDate(DateUtils.getNowDate());
        return qualifSourceMapper.insertQualifSource(qualifSource);
    }

    /**
     * 修改单位资质资源
     * 
     * @param qualifSource 单位资质资源
     * @return 结果
     */
    @Override
    public int updateQualifSource(QualifSource qualifSource)
    {
        SysUser user = ShiroUtils.getSysUser();
        qualifSource.setMaintainPerson(user.getUserName());
        qualifSource.setMaintainDate(DateUtils.getNowDate());
        return qualifSourceMapper.updateQualifSource(qualifSource);
    }

    /**
     * 批量删除单位资质资源
     * 
     * @param ids 需要删除的单位资质资源ID
     * @return 结果
     */
    @Override
    public int deleteQualifSourceByIds(Long[] ids)
    {
        return qualifSourceMapper.deleteQualifSourceByIds(ids);
    }

    /**
     * 删除单位资质资源信息
     * 
     * @param id 单位资质资源ID
     * @return 结果
     */
    @Override
    public int deleteQualifSourceById(Long id)
    {
        return qualifSourceMapper.deleteQualifSourceById(id);
    }
}
